var menu = {
	ms: {},
	containsKey: function(key){   
		for(var p in this.ms){   
			if(p==key)   
				return true;   
		}
		return false;   
	},
	put: function(key, val){
		if(!key || !val) return;
		
		var mli = [];
		if(this.containsKey(key)){
			mli.push(this.ms[key]);
		}
		mli.push("<li><a href='###'>");
		mli.push(val);
		mli.push("</a></li>");
		this.ms[key] = mli.join("");
	},
	show: function(key){
		this.reset().append($('<ul></ul>').append(this.ms[key]));
	},
	reset: function(){
		return $("#subMenu").empty();
	}
};
function setTimes() {
	 var ctimer;
	 var now = new Date();
	 var year = now.getYear();
	 var month = now.getMonth() + 1;
	 var date = now.getDate();
	 var hours = now.getHours();
	 var minutes = now.getMinutes();
	 var seconds = now.getSeconds();
	 var day = now.getDay();
	 var Day = [];
	 Day[0]="星期天";
	 Day[1]="星期一";
	 Day[2]="星期二";
	 Day[3]="星期三";
	 Day[4]="星期四";
	 Day[5]="星期五";
	 Day[6]="星期六";
	 var timeValue = "";
	 timeValue += year + "年";
	 timeValue += ((month < 10) ? "0" : "") + month + "月";
	 timeValue += ((date < 10) ? "0" : "") + date + "日  ";
	 timeValue += (Day[day]) + "  ";
	 timeValue += (hours);
	 timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	 timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
	 $("#id_timeBar").html(timeValue);	
	 ctimer =  setTimeout("setTimes()",1000);
}
$(function(){
	$("#id_mainMenu > li").mouseover(function(){
		var pid = $(this).attr("value");
		var sMenu = $('<ul></ul>').append($("#subMenu_ul").children("li[value="+pid+"]").clone());
		$("#subMenu").empty().append(sMenu);
		
		var p = $(this).offset();
		sMenu.css({
			left: (p.left - sMenu.outerWidth()/2 + $(this).outerWidth()/2)+"px",
			top: (p.top + $(this).outerHeight()+1) + "px"
		});
	});
	 setTimes();
});
